#include <iostream>
#include <memory>

using namespace std;

template<typename T>
using Scope  =  std::unique_ptr<T>;
template<typename T, typename ...Args>
constexpr Scope<T> CreateScope(Args&& ...args)
{
	return std::make_unique<T>(std::forward<Args>(args)...);
}



int main()
{
	{
		double pi{ 3.1415 };
		auto myLambda{ [myCapture = "Pi: ", pi] { cout << myCapture << pi; } };
		myLambda();
	}

	cout << endl;

	{
		auto myPtr{ CreateScope<double>(3.1415) };
		auto myLambda{ [p = move(myPtr)] { cout << *p; } };
		myLambda();
	}

	cout << endl;

	{
		auto myPtr{ CreateScope<double>(3.1415) };
		auto myLambda{ [myPtr = move(myPtr)] { cout << *myPtr; } };
		myLambda();
	}

	cout << endl;
}
